<?php $this->load->view('layout/header'); ?>
<script type="text/javascript" charset="utf-8" src="/static/bk/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/bk/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/bk/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/bk/ueditor/lang/zh-cn/zh-cn.js"></script>
<script language="javascript" type="text/javascript" src="/static/bk/datepicker/WdatePicker.js"></script>
<script type="text/javascript">
    //<![CDATA[
    var theForm = document.forms['form1'];
    if (!theForm) {
        theForm = document.form1;
    }
    function __doPostBack(eventTarget, eventArgument) {
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
            theForm.__EVENTTARGET.value = eventTarget;
            theForm.__EVENTARGUMENT.value = eventArgument;
            theForm.submit();
        }
    }
    //]]>
</script>
<script type="text/javascript">
    //<![CDATA[
    function WebForm_OnSubmit() {
        if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
        return true;
    }
    //]]>
</script>
<form name="form1" method="post" action="<?php echo site_url('job/job_action').'/'.$info['jobid'];?>" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
    <div>
    </div>
    <div id="container">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_form">
            <tr class="table_form_title">
                <td colspan="4">
                    <span id="lblTitle">添加</span>招聘
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>语言版本：
                </td>
                <td>
                    <select id="configid">
                        <option value="">请选择</option>
                        <?php foreach($config as $key=>$val): ?>
                            <option value="<?php echo $val['configid']?>" <?php if($val['configid']==$info['configid']){echo 'selected';}?>><?php echo $val['languagever']?></option>
                        <?php endforeach; ?>
                    </select>
                    <span id="configid_tips" style="color: Red;display: none">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>栏目分类：
                </td>
                <td>
                    <select name="classid" id="classid">
                        <option value="">请选择</option>
                        <?php foreach($classtree as $key=>$val): ?>
                            <option value="<?php echo $key?>" <?php if($key==$info['classid']){echo 'selected';}?>><?php echo $val?></option>
                        <?php endforeach; ?>
                    </select>
                    <span id="classid_tips" style="color: Red;display: none">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>职位名称：
                </td>
                <td>
                    <input type="text" name="jobname" id="jobname" value="<?php echo $info['jobname']?>">
                    <span id="jobname_tips" style="color: Red;display: none">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>招聘部门：
                </td>
                <td>
                    <input name="department" value="<?php echo $info['department']?>" type="text" id="department" />
                    <span id="department_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>招聘人数：
                </td>
                <td>
                    <input type="text" name="jobnum" value="<?php echo $info['jobnum']?>" id="jobnum">
                    <span id="jobnum_tips" style="color: Red;display: none">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>待遇：
                </td>
                <td>
                    <input name="salary" value="<?php echo $info['salary']?>" type="text" id="salary" />
                    <span id="salary_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>工作地点：
                </td>
                <td>
                    <input name="workplace" value="<?php echo $info['workplace']?>" type="text" id="workplace" />
                    <span id="workplace_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    关键字：
                </td>
                <td>
                    <input name="keywords" value="<?php echo $info['keywords']?>" type="text" />
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    简单描述：
                </td>
                <td>
                    <textarea name="description"><?php echo $info['description']?></textarea>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    详细要求：
                </td>
                <td>
                    <script id="details" type="text/plain" style="width: 100%; height: 350px;"><?php echo $info['details']; ?></script>
                    <script type="text/javascript">
                        var ue = UE.getEditor('details', {
                            textarea: 'details'
                        });</script>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>截止日期：
                </td>
                <td>
                    <input class="Wdate" name="endtime" readonly="readonly" type="text" onClick="WdatePicker({dateFmt: 'yyyy-MM-dd'})" value="<?php echo $info['endtime']; ?>" id="endtime">
                    <span id="endtime_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    设置：
                </td>
                <td>
                    <input type="checkbox" name="isrecommend" value="1" <?php if($info['isrecommend']==1){echo 'checked';}?>>推荐
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>访问次数：
                </td>
                <td>
                    <input type="text" name="clicknum" value="<?php echo $info['clicknum']?>" id="clicknum">
                    <span id="clicknum_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>排序：
                </td>
                <td>
                    <input type="text" name="listid" value="<?php if($info['listid']){echo $info['listid'];}else{echo 0;}?>" id="listid">
                    <span id="listid_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    是否关闭：
                </td>
                <td>
                    <input type="radio" name="isclose" value="1" <?php if(isset($info['isclose']) && $info['isclose'] == '1'){echo 'checked'; }?>>是
                    <input type="radio" name="isclose" value="0" <?php if(!isset($info['isclose']) || $info['isclose'] == '0'){echo 'checked'; }?>>否
                </td>
            </tr>
            <tr class="table_form_btn">
                <td align="right">
                    &nbsp;
                </td>
                <td colspan="3">
                    <input type="submit" value="保存" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;btnSave&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="btnSave" />
                    <input type="button" value="返回" onclick="javascript:history.go(-1);" />
                    <span id="errMsg" style="color:Red;"></span>
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">
    $('#form1').submit(function() {
        var is = true;
        if(!selete_tips($('#configid'))){
            is = false;
        }
        if(!selete_tips($('#classid'))){
            is = false;
        }
        if (!input_tips($('#jobname'))) {
            is = false;
        }
        if (!input_tips($('#department'))) {
            is = false;
        }
        if (!input_tips($('#jobnum'))) {
            is = false;
        }
        if (!input_tips($('#salary'))) {
            is = false;
        }
        if (!input_tips($('#workplace'))) {
            is = false;
        }
        if (!input_tips($('#endtime'))) {
            is = false;
        }
        if (!input_tips($('#clicknum'))) {
            is = false;
        }
        if (!input_tips($('#listid'))) {
            is = false;
        }
        return is;
    });

    $('#configid').change(function() {
        if (this.id == 'configid') {
            $.ajax({
                type: "get",
                url: b_url + "/job/get_class?configid=" + this.value,
                dataType: 'html',
                beforeSend:
                    function() {
                    },
                success:
                    function(data) {
                        $('#classid').empty();
                        $("#classid").html(data);
                        /*for (var key in data) {
                         $('#classid').prepend("<option value='" + key + "'>" + data[key] + "</option>");
                         }
                         $("#classid").prepend("<option value='-1' selected='selected' >请选择</option>");*/
                    }
            });
        }
        selete_tips($(this));
    });
</script>
</body>
</html>

